/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package windowlogger;

import java.util.logging.Handler;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;

/**
 *
 * @author sharrock
 */
public final class GlobalLoggerHandler extends Handler {
    
public GlobalLoggerHandler(){ 
    Logger l = Logger.getGlobal();
    l.addHandler(this);
    l.info("Global handler initialized");
}
    private final InputOutput inputOutput = IOProvider.getDefault().getIO("Global Logger", false);

    @Override
    public void publish(LogRecord record) {
        inputOutput.getOut().println("" + record.getLevel().getLocalizedName() + " :" + record.getMessage());
    }

    @Override
    public void flush() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void close() throws SecurityException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    

}
